package com.demo.service.riot;

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

public class RiotApiEncoder {

    public static String encodeForRiotApi(String value) {
        if (value == null) return "";
        try {
            // 先进行标准编码
            String encoded = URLEncoder.encode(value, StandardCharsets.UTF_8.toString());
            // 将 + 替换为 %20
            return encoded.replace("+", "%20");
        } catch (Exception e) {
            return value; // 回退到原始值
        }
    }
}
